<template>
  <div class="tab_content1">
    <!-- 暂未开通状态 -->
     <div class="box1" v-if="!userInfo">
      <div class="box1_d1">敬请期待</div>
      <img src="../../asset/images/map@3x.png" alt="">
      <div>当前定位城市（杭州）暂未开通</div>
      <div class="tab_content1_footer">
        <button class="tab_content1_footer_btn" @click="goToJoin">我想加入</button>
      </div>
    </div>

    <!-- 收工状态 -->
    <!-- <div class="box1">
      <div><img src="../../asset/images/taskgoing.png" alt=""></div>
      <div class="text">
        <div>您当前处于收工状态</div>
        <div>收工将不再接收到新的任务提示</div>
      </div>
      <div class="tab_content1_footer">
        <button class="tab_content1_footer_btn" >
          <img src="../../asset/images/taskgoing2.png" alt="">
          我要开工
        </button>
      </div>
    </div> -->

    <!-- 抢单 -->
    <div class="content_robbing_box" v-if="userInfo">
      <!-- 无订单状态 -->
      <div v-if="list.length==0">
        <div class="content_robbing_box_text">
          <div class="content_robbing_box_img"><img src="../../asset/images/no_order2x.png" alt=""></div>
          <div>暂时没有订单哦~</div>
          <div>点击“刷新列表”试试</div>
        </div>
      </div>
      <!-- 有订单状态 -->
      <div class="content_robbing" v-else v-for="item in list" :key="item.orderNo" >
        <div class="content_text" @click="goToDetail(item.orderNo)">
          <div class="img"><img :src=item.img alt=""></div>
          <div class="content_text_r">
            <div class="content_text_r1">
              <span>距离：{{item.range}} 米</span>
              <span style="color:#4694ff">{{item.state}}</span>
            </div>
            <div>{{item.address}}</div>
            <div>备注：{{item.remark}}</div>
          </div>
        </div>
        <div class="btn" @click="GoToGoing"><button>抢单</button></div>
      </div>
      <div class="footer">
        <button @click="refshe">
          <i class=" iconfont icon-shuaxin"></i>
          刷新列表
        </button>
      </div> 
    </div> 
    <!-- 接单提醒   -->
    <van-popup v-model="show"  :overlay="true">
      <div class="box">
        <div class="box_top">
          <div class="box_top_1">接单提醒</div>
          <div @click="close"><i class="iconfont icon-guanbi1"></i></div>
        </div>
        <div class="box_img">
          <img src="../../asset/images/69594998252967366@2x.png" alt="">
        </div>
        <div class="box_1">
          <div>距离：600米</div>
          <div class="d2">普通订单</div>
        </div>
        <div class="box_2">
          拱墅区相符街道海蓝创智天地503
        </div>
        <div class="box_3">
          备注：需要打电话
        </div>
        <div class="box_4">
          查看详情
          <i class="iconfont icon-unie61f"></i>
        </div>
        <div class="box_5">
          <button>接单(剩余 29 ：30)</button>
        </div>
        <div class="box_6">
          老客户下单，累计五次半小时内不接单，您将不能再次为该用户服务
        </div>
      </div> 
    </van-popup>
</div> 
</template>
<script>
import {  mapGetters } from 'vuex';
import { getNewTaskOrderLists,getReceiveOrderRemainingTime} from 'services/order';

export default {
  name: "newtask",
  data() {
    return {
      list: [],//订单列表数据
      show:true,
    };
  },
  computed: {
    ...mapGetters(['userInfo'])
  },
  created() {
   this.getOrderList(),
   this.getTime()
  },
  methods: {
    goToJoin() {
      this.$router.push('/join');
    },
    GoToGoing(){
      console.log(1);
    },
    close() {
      this.show = !this.show;
    },
    goToDetail(orderNo) {
      this.$router.push({ name: 'orderdetail', params: { orderNo } });
    },
    getOrderList(){
      const { userNo } = this.userInfo;
      getNewTaskOrderLists({ userNo }).then(response => {
        //console.log(response);
        const { object } = response;
        //console.log(object);
        object.forEach((item,index) => {
          this.list.push(item);
        });
      })
    },
    getTime(){
        getReceiveOrderRemainingTime( {orderNos:1} ).then(response=>{
          const { object } = response;
        })
    },
    refshe(){
      window.location.reload();
    }
  }
};
</script>
<style lang="less">
.tab_content1 {
  //暂未开通状态 收工状态
  .box1 {
    text-align: center;
    margin: 0 auto;
    padding-top: 106px;
    font-size: 34px;
    color: #333;
    .box1_d1 {
      font-size: 28px;
      color: #999;
    }
    img {
      width: 200px;
      height: 200px;
      margin: 30px 0;
    }
    .text {
      //我要开工文字状态
      font-size: 28px;
      color: #999;
      margin-top: 20px;
    }
    .tab_content1_footer {
      height: 142px;
      position: fixed;
      bottom: 0;
      background: #fff;
      padding: 26px 30px;
      font-size: 36px;
    }
    .tab_content1_footer_btn {
      width: 690px;
      height: 90px;
      color: white;
      background-color: rgb(247, 165, 40);
      border: none;
      border-radius: 50px;
      text-align: center;
      img {
        width: 35px;
        height: 35px;
      }
    }
  }
  //抢单
  .content_robbing_box {
    padding-bottom: 180px;
    .content_robbing_box_text{
      text-align:center;
      margin:0 auto;
      padding-top:200px;
      color:#999;
      font-size:32px;
    }
    .content_robbing_box_img{
      width:200px;
      margin:0 auto;
      text-align: center;
    }
    .content_robbing {
      width: 100%;
      display: flex;
      flex-direction: column;
      //margin-top:30px;
      padding: 30px 30px;
      background: #fff;
      margin-top: 30px;
      //padding-bottom: 100px;
      .content_text {
        display: flex;
        font-size: 30px;
        color: #333;
        .img {
          width: 128px;
          height: 128px;
        }
        .content_text_r {
          width: 80%;
          margin-left: 30px;
          display: flex;
          flex-direction: column;
          .content_text_r1 {
            display: flex;
            justify-content: space-between;
          }
        }
      }
      .btn {
        margin-top: 30px;
        button {
          width: 690px;
          height: 80px;
          border-radius: 50px;
          background: #f7a427;
          color: #fff;
          font-size: 32px;
          border: none;
          outline: none;
        }
      }
    }
    .footer {
      width: 100%;
      background: #fff;
      position: fixed;
      bottom: 0px;
      height: 136px;
      text-align: center;
      padding-top: 30px;
      button {
        width: 690px;
        height: 80px;
        border-radius: 50px;
        background: #fff;
        font-size: 36px;
        border: 2px solid #999;
        outline: none;
        color: #333;
      }
      .icon-shuaxin {
        font-size: 36px;
      }
    }
  }
  //接单提醒
  .van-popup{
    width:620px;
    height:636px;
    border-radius: 30px;
    padding:30px 30px;
  }
  .box{
    font-size:30px;
    .box_top,.box_1{
      display:flex;
      justify-content: space-between;  
    }
    .box_top{
      font-size:32px;
      color:#333;
    }
    .box_top_1{
      width: 95%;
      text-align: center;
    }
    .box_img{
      text-align: center;
      margin:0 auto;
      width:116px;
      height:116px;
      img{
        width:100%;
      }
    }
    .box_1{
      .d2{
        color:#4694ff;
      }
    }
    .box_2{
      color:#999;
    }
    .box_4{
      text-align: right;
      color:#f7a427;
    }
    .box_5{
      text-align: center;
      margin:50px auto;
      button{
        width:482px;
        height:60px;
        background:#fff;
        border:1px solid #999;
        border-radius: 50px;
      }
    }
    .box_6{
      text-align: center;
      font-size:20px;
      width:400px;
      margin:0 auto;
    }
  }
}
</style>
